{% extends "personal_center/base.html" %}
<!--固定资产付款创建页-->
{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" href="../../static/public_file/css/ApprovalBox.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        tr {
            height: 37px;
        }
        th {
            text-align: center;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin: 5px 0;
        }
        #page_one button:hover {
            color: red;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .a_tag_cla {
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div class="headline">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>
        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
            附件
        </div>
        <div id="lct_tag" class="tab_top" onclick="change_mind('lct')">
            流程图
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>
        <div style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;">
                <a href="javascript:history.go(-1)" style="color: white;">返回</a></button>
        </div>
        <!-- 操作按钮隐藏块 -->
        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button onclick="print_topics()" class="button_for_control">
                打印
            </button>
            {% if is_audit == 'true' and is_edit == 'false' %}
                <button id="approve" onclick="online_approval_tag()" class="button_for_control">
                    审批
                </button>
            {% endif %}

            {% if is_stop == 'true' and is_edit == 'false' %}
                <button id="is_stop" onclick="operate_button(this.id)" class="button_for_control">
                    终止
                </button>
            {% endif %}

            {% if is_edit == 'true' %}
                <button id="add_station" type="button" class="button_for_control" onclick="ExportCar()">
                    提交
                </button>
            {% endif %}
        </div>
    </div>
    <hr>

    <div id="appave-model" class="approval-shade">
        <div id="examine-model" style="width: 700px;background: white;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div id="appave-title" style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;font-size: 14px;cursor: move;">
                <div style="width: 40%;height: 40px;line-height: 40px;text-align: left;padding-left: 1%;letter-spacing: 2px;float: left;">
                    审批
                </div>
                <div style="width: 59%;height: 40px;letter-spacing: 2px;float: left;">
                    <div onclick="close_approval_models()" style="width: 40px;height: 40px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <i class="iconfont icon-quchu"></i>
                    </div>
                </div>
            </div>

            <div style="width: 100%;font-size: 14px;background: #E8E8E8;padding-top: 1%;">
                <div style="width: 98%;height: 150px;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;padding-right: 1%;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        基本信息
                    </div>
                    <div style="width: 100%;height: 125px;padding-left: 1%;">
                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">申请人：</span>{{ obj.apply_user.real_name }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">申请部门：</span>{{ obj.company.name }}
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">申请时间：</span>{{ obj.create_time|date:"Y-m-d H:i" }}
                            </div>
                        </div>
                    </div>
                </div>

                <div style="width: 98%;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;margin-top: 1%;padding-right: 1%;padding-bottom: 20px;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        意见
                    </div>
                    <div style="width: 100%;">
                        <textarea id="opinion_detail" placeholder="请输入审批意见" style="width: 96%;height: 100px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;" ></textarea>
                    </div>
                </div>

                <div style="width: 100%;height: 40px;background: white;margin-top: 1%;text-align: right;padding-right: 2%;">
                    <button onclick="summit_data('audit')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;">同意</button>
                    <button onclick="summit_data('draft')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;margin-left: 15px;">退回修改</button>
                </div>
            </div>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;overflow: auto;">
        <div id="menu_from" style="width: 100%;height: auto;color: #2C3E50;display: inline-block;vertical-align: top;background: white;">
            <div style="width: 100%;height: 90%;display: inline-block;vertical-align: center;">
                <div style="width: 95%;margin-left: 2.5%;">
                    <table style="width: 100%;margin-top: 20px;">
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;">
                                <h3 id="form_name" style="letter-spacing: 8px;">图书/报刊/杂志征订</h3>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cfcfcf solid 1px;border-top: none;">基本信息</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                                申&nbsp;&nbsp;请&nbsp;&nbsp;人
                            </td>
                            <td id="applicat" style="width: 35%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.apply_user.real_name }}</td>

                            <td style="width: 15%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                                申请部门
                            </td>
                            <td id="department" style="width: 35%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.company.name }}</td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cfcfcf solid 1px;">申请详情</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td colspan="4" style="width: 100%;border: #cfcfcf solid 0.5px;text-align: center;height: 40px;line-height: 40px;">
                                书籍购买
                                {% if is_edit == 'true' %}
                                    <span style="float: right;padding-right: 10px;color: #00a0e9;cursor: pointer;" onclick="add_total_project()">添加</span>
                                {% endif %}
                            </td>
                        </tr>
                    </table>
                    <table id="BookBuy" style="width: 100%;table-layout:fixed">
                        <tr style="width: 100%;">
                            <td style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">序号</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">书籍名称</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">作者</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">出版社</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">第几版</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">数量(册)</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">备注</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">科室</td>
                        </tr>
                        {% if book_buy|length %}
                            {% for foo in book_buy %}
                                <tr style="width: 100%;">
                                    <td class="a" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">{{ foo.a }}</td>
                                    <td class="b" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.b }}" contenteditable="{{ is_edit }}">{{ foo.b }}</td>
                                    <td class="c" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.c }}" contenteditable="{{ is_edit }}">{{ foo.c }}</td>
                                    <td class="d" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.d }}" contenteditable="{{ is_edit }}">{{ foo.d }}</td>
                                    <td class="e" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.e }}" contenteditable="{{ is_edit }}">{{ foo.e }}</td>
                                    <td class="z" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.z }}" contenteditable="{{ is_edit }}">{{ foo.z }}</td>
                                    <td class="f" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.f }}" contenteditable="{{ is_edit }}">{{ foo.f }}</td>
                                    <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;">
                                        <p class="g" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;text-align: center;" contenteditable="{{ is_edit }}">{{ foo.g }}</p>
                                        {% if is_edit == 'true' %}
                                            <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        {% else %}
                            <tr style="width: 100%;">
                                <td class="a" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">1</td>
                                <td class="b" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="c" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="d" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="e" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="z" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="f" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;">
                                    <p class="g" style="width: 83%;height: 100%;display: inline-block;vertical-align: top;" contenteditable="{{ is_edit }}"></p>
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    <table style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td colspan="4" style="width: 100%;border: #cfcfcf solid 0.5px;text-align: center;height: 40px;line-height: 40px;border-top: none;">
                                报刊杂志征订
                                {% if is_edit == 'true' %}
                                    <span style="float: right;padding-right: 10px;color: #00a0e9;cursor: pointer;" onclick="add_total_project1()">添加</span>
                                {% endif %}
                            </td>
                        </tr>
                    </table>
                    <table id="PressBuy" style="width: 100%;table-layout:fixed;">
                        <tr style="width: 100%;">
                            <td style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">序号</td>
                            <td style="width: 40.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">报刊杂志名称</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">邮发代号</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">数量(份)</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">备注</td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">科室</td>
                        </tr>
                        {% if reason|length %}
                            {% for foo in reason %}
                                <tr style="width: 100%;">
                                    <td class="h" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">{{ foo.h }}</td>
                                    <td class="i" style="width: 40.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.i }}" contenteditable="{{ is_edit }}">{{ foo.i }}</td>
                                    <td class="j" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.j }}" contenteditable="{{ is_edit }}">{{ foo.j }}</td>
                                    <td class="y" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.y }}" contenteditable="{{ is_edit }}">{{ foo.y }}</td>
                                    <td class="k" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" title="{{ foo.k }}" contenteditable="{{ is_edit }}">{{ foo.k }}</td>
                                    <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="{{ is_edit }}">
                                        <p style="width: 70%;height: 100%;display: inline-block;vertical-align: top;text-align: center;" class="l" contenteditable="{{ is_edit }}">{{ foo.l }}</p>
                                        {% if is_edit == 'true' %}
                                            <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        {% else %}
                            <tr style="width: 100%;">
                                <td class="h" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">1</td>
                                <td class="i" style="width: 40.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="j" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="y" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td class="k" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="{{ is_edit }}"></td>
                                <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="{{ is_edit }}">
                                    <p class="l" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;" contenteditable="{{ is_edit }}"></p>
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    <table style="width: 100%;">
                        <tr>
                            <td colspan="2" style="height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cfcfcf solid 0.5px;border-top: none;">
                                审批详情
                            </td>
                        </tr>
                        {% if 'one' in audit_dic %}
                            <tr id="fzrcs_tr" style="width: 100%;{% if obj.is_leader == True %} display: none{% endif %}">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    科主任审核
                                </td>
                                <td id="fzrcs"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'one' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div id="fzrcs_op"
                                                         style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'two' in audit_dic %}
                            <tr id="fgld_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    图书室查询
                                </td>
                                <td id="fgld"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'two' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'three' in audit_dic %}
                            <tr id="three_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    病案统计科
                                </td>
                                <td id="three"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'three' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'four' in audit_dic %}
                            <tr id="four_tr" style="width: 100%;">
                                <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    病案统计科分管领导
                                </td>
                                <td id="four"
                                    style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'four' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        <img src="{{ item.signature_picture }}" alt=""
                                                             style="width: 150px; height: 60px;">
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                </div>
                {% if is_edit == 'true' %}
                    <div style="width: 95%;margin-left: 2.5%;">
                        <div style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                            上传附件
                            <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                                上传文件
                                <input type="file" name="party_main_body" id="party_main_body"
                                       onchange="upload_accessory('file1', 'party_main', 'party_main_body')">
                            </a>
                        </div>
                        <table style="width: 100%;">
                            <thead>
                            <tr>
                                <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                    文件名称
                                </td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                    文件大小
                                </td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                    上传时间
                                </td>
                                <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                    上传人员
                                </td>
                                <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作
                                </td>
                            </tr>
                            </thead>
                            <tbody style="overflow: auto;" id="party_main">
                                {% for record in file_list %}
                                    <tr>
                                        <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">{{ forloop.counter }}</td>
                                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_name }}</td>
                                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_size }}</td>
                                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.upload_time }}</td>
                                        <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.uploader }}</td>
                                        <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;"><a target='_blank' href="{{ record.file_path }}">查看</a> | <a style="color: red;" href='#' onclick='RemoveTr(this, "party_main", {{ record.id }})' >删除</a></td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                {% endif %}
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div id="yt_zhengwen" style="width: 100%;">
                {% for item in file_list %}
                    <div><a href="#" class="a_tag_cla" title="{{ item.file_name }}" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                {% endfor %}
            </div>

        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="lct" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% if 'one' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'one' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                科主任审核
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'two' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'two' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                图书室查询
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'three' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'three' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                病案统计科
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'four' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'four' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                病案统计科分管领导
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>

{% endblock %}

{% block script %}
    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="../../static/public_file/js/ApprovalBox.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add-nav-active";
        };

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }else if (ele_id === "LH") {
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            }else {
                document.getElementById("lct").style.display = "inline-block";
                document.getElementById("lct_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }


        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function summit_data(approve) {
            var present_id = '{{ obj.id }}';

            var audit_note = document.getElementById("opinion_detail").value;
            if (approve === "draft") {
                if (!audit_note) {
                    alert("不同意请填写理由！");
                    return false
                }
            }
            var note_str = "id=" + present_id + "&state=" + String(approve) + "&audit_note=" + String(audit_note)

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/finance/BookSubscriptionDetail.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send(note_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = '/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd='
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function ExportCar() {
            var a_list = document.getElementsByClassName('a');
            var b_list = document.getElementsByClassName('b');
            var c_list = document.getElementsByClassName('c');
            var d_list = document.getElementsByClassName('d');
            var e_list = document.getElementsByClassName('e');
            var f_list = document.getElementsByClassName('f');
            var g_list = document.getElementsByClassName('g');
            var z_list = document.getElementsByClassName('z');
            var BookBuyList = []
            for (var i=0; i<a_list.length; i++) {
                BookBuyList.push({'a': a_list[i].innerText, 'b': b_list[i].innerText, 'c': c_list[i].innerText, 'd': d_list[i].innerText, 'e': e_list[i].innerText, 'f': f_list[i].innerText, 'g': g_list[i].innerText, 'z': z_list[i].innerText})
            }

            var h_list = document.getElementsByClassName('h');
            var i_list = document.getElementsByClassName('i');
            var j_list = document.getElementsByClassName('j');
            var k_list = document.getElementsByClassName('k');
            var l_list = document.getElementsByClassName('l');
            var y_list = document.getElementsByClassName('y');
            var PressBuyList = []
            for (var j=0; j<h_list.length; j++) {
                PressBuyList.push({'h': h_list[j].innerText, 'i': i_list[j].innerText, 'j': j_list[j].innerText, 'k': k_list[j].innerText, 'l': l_list[j].innerText, 'y': y_list[j].innerText})
            }

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/finance/BookSubscriptionIndex.html", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+'{{ obj.id }}'+"&BookBuyList=" + JSON.stringify(BookBuyList) + "&PressBuyList=" + JSON.stringify(PressBuyList));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("修改成功！");
                            window.location = "/finance/BookSubscriptionList.html";
                        } else {
                            alert(JsonDate['message']);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
            };
        }

        function operate_button(ele_id) {
            var id = '{{ obj.id }}'
            if (ele_id === 'is_stop') {
                var state = 'stop';     // 终止
                var word = '终止'
            } else if (ele_id === 'is_cancel') {
                state = 'cancel';       // 作废
                word = '作废'
            } else {
                state = 'recall'
                word = '撤回'
            }
            var r = confirm('是否' + word + '流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/finance/BookSubscriptionStop.html", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("state=" + state + "&id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert(JsonDate['message'])
                            window.location.href = "/finance/BookSubscriptionList.html"
                        }
                    }
                };
            }
        }

        function print_topics() {
            $('#menu_from').jqprint({
                debug: false,
                importCSS: true,
                printContainer: true,
                operaSupport: false
            });
        }

        function add_total_project() {
            var counts = document.getElementsByClassName('a').length+1;
            var html = `
                        <tr style="width: 100%;">
                            <td class="a" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">`+String(counts)+`</td>
                            <td class="b" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="c" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="d" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="e" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="z" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="f" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true">
                                <p class="g" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;text-align: center;" contenteditable="true"></p>
                                <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                            </td>
                        </tr>
            `
            $("#BookBuy").append(html);
        }

        function add_total_project1() {
            var counts = document.getElementsByClassName('h').length+1;
            var html = `
                        <tr style="width: 100%;">
                            <td class="h" style="width: 5.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;">`+String(counts)+`</td>
                            <td class="i" style="width: 40.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="j" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="y" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td class="k" style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;border-top: none;" contenteditable="true"></td>
                            <td style="width: 13.5%;height: 40px;line-height: 40px;border: #cfcfcf solid 1px;border-top: none;" contenteditable="true">
                                <p class="l" style="width: 70%;height: 100%;display: inline-block;vertical-align: top;text-align: center;" contenteditable="true"></p>
                                <span onclick="remove_time_adress(this, '1')" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                            </td>
                        </tr>
            `
            $("#PressBuy").append(html);
        }

        function remove_time_adress(obj, word) {
            var trNode = $(obj).parent().parent();
            trNode.remove();
        }

        // 上传附件
        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', '{{ obj.fj_number }}')
            form.append('source', 'tszz')
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table(JsonDate, tbody_id)
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var tr = document.createElement("tr");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                    td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["pdf_path"][i]["id"] + "\")'>删除</a>";
                    td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1) {
                    document.getElementById("del_adjunct").style.display = 'block';
                }
            } else {
                tr = document.createElement("tr");td1 = document.createElement("td");td2 = document.createElement("td");td3 = document.createElement("td");td4 = document.createElement("td");td5 = document.createElement("td");td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["id"] + "\")'>删除</a>";
                td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);t_table.appendChild(tr);
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }
    </script>
{% endblock %}
